<!DOCTYPE html>
<html lang="en" xmlns:v-text="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>

<div id="app">
    <div>姓名：{{name}}</div>
    <div>年龄：{{age}}</div>
    <button onclick="hi()">打招呼</button>
    <button onclick="upAge()">更改年龄</button>
    <button @click="study()">介绍</button>
    <!--不能直接用onclick调用methods中定义的方法-->
</div>

</body>
<script src="js/vue.js"></script>
<script>
    let vue = new Vue({
        el: "#app",
        data: {
            name:"hello vue",
            age:18
        },
        methods:{
            study(){
                alert(this.name+"今年年龄为"+this.age);
                this.name="就这";
            }
        }
    })

    function hi() {
        vue.study();
    }

    function upAge() {
        vue.age=22;
    }
</script>
</html>